#pragma once

#include <string>
#include <fstream>
using namespace std;

#include "topconn_cfg.hpp"

namespace topconn
{
	struct ConnCfgInfo
	{
		string cfgpath;
		uint64_t modifyTime;
	};

	class ConnResourceLoader
	{
		static bool m_pathLoadMode;
		static std::map<string, string> m_resource;
		static std::map<string, long> m_lastTime;

		static bool cacheContains(const string& fileName);
		static void put2Cache(const string& fileName, const long lastModified, const string& context);
	public:
		static void setPathLoadMode(bool on);
		static uint64_t getMtime(const char* lpszFileName);
		static RootCfg& getConnCfg(const string& connPath, RootCfg& rootCfg);
		static RootCfg& getConnBuf(const string& connBuff, RootCfg& rootCfg);
	};
};